<?php

/**
 * @package Bike
 * @subpackage Db
 */

/**
 * Database factory
 * @author Chrome
 * @package Bike
 * @subpackage Db
 */
class Bike_Db {
	
	/**
	 * Get database handler by $config
	 * @param array $config
	 * @return Bike_Db_Idb
	 */
	public static function factory(array $config){
		$adapterName = 'Bike_Db_' . str_replace(' ', '_', ucwords(str_replace('_',' ', strtolower($config['driver']))));
		return new $adapterName($config['dbhost'], $config['dbname'], $config['dbuser'], $config['dbpass'], $config['options'], $config['initialQuery']);
	}
}
